package com.weishuang.monitor.leader.controller;


import com.weishuang.monitor.leader.commons.entity.Result;
import com.weishuang.monitor.leader.commons.utils.ResultUtils;
import com.weishuang.monitor.leader.service.ISysUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户角色关联表 前端控制器
 * </p>
 *
 * @author weishuang
 * @since 2021-03-23
 */
@RestController
@RequestMapping("/leader/sysUserRole")
public class SysUserRoleController {

    @Autowired
    private ISysUserRoleService sysUserRoleService;

    /**
     * 给用户授权
     * @param roleIds
     * @param userId
     * @return
     */
    @PostMapping("allotRoleForUser/{userId}")
    public Result allotRoleForUser(String[] roleIds, @PathVariable String userId) {
        sysUserRoleService.allotRoleForUser(roleIds, userId);
        return ResultUtils.success();
    }
}
